package Leetcode.DayTest;

import java.util.*;

public class OppoTest24 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
            b[i] = scanner.nextInt();
        }

        // Preprocess for a (appearance)
        int[] aSorted = a.clone();
        Arrays.sort(aSorted);
        int aMin1 = aSorted[0];
        int aMin2 = aSorted[1];
        int aMax1 = aSorted[n - 1];
        int aMax2 = aSorted[n - 2];
        long aTotal = 0;
        for (int num : a) {
            aTotal += num;
        }

        // Preprocess for b (performance)
        int[] bSorted = b.clone();
        Arrays.sort(bSorted);
        int bMin1 = bSorted[0];
        int bMin2 = bSorted[1];
        int bMax1 = bSorted[n - 1];
        int bMax2 = bSorted[n - 2];
        long bTotal = 0;
        for (int num : b) {
            bTotal += num;
        }

        for (int i = 0; i < n; i++) {
            long currentA = a[i];
            long currentB = b[i];

            // Calculate new aTotal and count remaining elements (n-1)
            long newATotal = aTotal - currentA;
            int newAN = n - 1;
            int newAMin, newAMax;

            if (currentA == aMin1) {
                newAMin = aMin2;
            } else {
                newAMin = aMin1;
            }

            if (currentA == aMax1) {
                newAMax = aMax2;
            } else {
                newAMax = aMax1;
            }

            long aSum = newATotal - newAMin - newAMax;
            double aAvg = (double) aSum / (newAN - 2);

            // Similarly for b
            long newBTotal = bTotal - currentB;
            int newBN = n - 1;
            int newBMin, newBMax;

            if (currentB == bMin1) {
                newBMin = bMin2;
            } else {
                newBMin = bMin1;
            }

            if (currentB == bMax1) {
                newBMax = bMax2;
            } else {
                newBMax = bMax1;
            }

            long bSum = newBTotal - newBMin - newBMax;
            double bAvg = (double) bSum / (newBN - 2);

            if ((aAvg + bAvg) % 2 == 0) {
                System.out.println((int) (aAvg + bAvg) / 2);
            }else{
                double finalScore = (aAvg + bAvg) / 2;
                System.out.println(finalScore);
            }
        }
    }
}